package com.api.gbhg.heyulei.action;

import com.alibaba.fastjson.JSON;
import com.api.gbhg.heyulei.dao.ReimbursementQueryDao;
import com.api.gbhg.heyulei.dao.impl.ReimbursementQueryDaoImpl;
import com.api.gbhg.heyulei.service.ReimbursementQueryService;
import com.api.gbhg.heyulei.service.impl.ReimbursementQueryServiceImpl;
import com.api.gbhg.luoao.utils.ReimbursementDao;
import weaver.conn.RecordSet;

import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 根据报销流程台账条件查询API
 * @author hyl
 * @version 1.0
 * @date 2021/4/17 13:58
 */
public class ReimbursementQueryAction {

/*
    private ReimbursementQueryService queryService = new ReimbursementQueryServiceImpl();

    private ReimbursementQueryDao queryDao = new ReimbursementQueryDaoImpl();

    @POST
    @Path("/queryList")
    @Produces(MediaType.APPLICATION_JSON)
    public String getQueryList(Map<String,Object> map){

         List<Map<String,Object>> list = new ArrayList<>();
        RecordSet getrequestId = queryDao.getRequestId(map);

        while (getrequestId.next()){
            Map<String, Object> mapdate = queryService.workflowInfo(getrequestId.getStringNoTrim("requestid"),map);
            if (! mapdate.isEmpty()){
                list.add(mapdate);
            }
        }

        int pageNum = Integer.parseInt(map.get("pageNum").toString());
        int pageSize = Integer.parseInt(map.get("pageSize").toString());
        Map<String,Object>  mapdate = new HashMap<>();
        mapdate.put("list",list);
        mapdate.put("pageNum",pageNum);
        mapdate.put("pageSize",pageSize);
        mapdate.put("total",queryDao.getcount());
        return JSON.toJSONString(mapdate);
    }

 */
}
